﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using XcoAppSpaces.Contracts.Transport;
//using XcoAppSpaces.Serialization.Binary;
using System.Diagnostics;

namespace test.XcoAppSpaces.Transport.Sockets
{
    class ReceivedTmp
    {
       public Stopwatch StopWatch { get; set; }
   
        public int Counter
        { get { return counter; }
        }
        public ReceivedTmp()
        {
            StopWatch = new Stopwatch();
        }
        
		//private XcoBinarySerializer ser1 = new XcoBinarySerializer();
        private int counter = 0;
       
		public void MessageReceived(XcoMessage msg, string remoteAddress, IXcoTransportService commService)
        {
			string n = Encoding.Default.GetString(msg.Content);
            Interlocked.Increment(ref counter);
           
			if (counter % 10000 == 0)
				Console.WriteLine("{0} @ {1} millisec", counter, StopWatch.ElapsedMilliseconds);
        }
    }

//    public class IntMsg
//    {
//        //public string RemoteAddress { get; set; }
//        public int value;
//        public string strValue1;
//        public string strValue2;
//        public List<MsgPart> msgPartList;
//    }
//
//    public class MsgPart
//    {
//        public string strValue;
//        public Exception exValue;
//    }
}
